<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Taskflow Handbook</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://taskflow.github.io/">Taskflow</a>
   &#160;<span id="projectnumber">3.0.0-Master-Branch</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classtf_1_1Executor.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="classtf_1_1Executor-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">tf::Executor Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>execution interface for running a taskflow graph  
 <a href="classtf_1_1Executor.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="executor_8hpp_source.html">executor.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a342562766963b1bbf65225803d93c071"><td class="memItemLeft" align="right" valign="top"><a id="a342562766963b1bbf65225803d93c071"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a342562766963b1bbf65225803d93c071">Executor</a> (size_t N=<a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency.html">std::thread::hardware_concurrency</a>(), size_t M=cuda_get_num_devices())</td></tr>
<tr class="memdesc:a342562766963b1bbf65225803d93c071"><td class="mdescLeft">&#160;</td><td class="mdescRight">constructs the executor with N/M cpu/gpu worker threads <br /></td></tr>
<tr class="separator:a342562766963b1bbf65225803d93c071"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4910e89d89146b6d563d598b795eb4a9"><td class="memItemLeft" align="right" valign="top"><a id="a4910e89d89146b6d563d598b795eb4a9"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a4910e89d89146b6d563d598b795eb4a9">Executor</a> (size_t N=<a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency.html">std::thread::hardware_concurrency</a>())</td></tr>
<tr class="memdesc:a4910e89d89146b6d563d598b795eb4a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">constructs the executor with N worker threads <br /></td></tr>
<tr class="separator:a4910e89d89146b6d563d598b795eb4a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a511b0cc23b264826373d3dabcef670"><td class="memItemLeft" align="right" valign="top"><a id="a5a511b0cc23b264826373d3dabcef670"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a5a511b0cc23b264826373d3dabcef670">~Executor</a> ()</td></tr>
<tr class="memdesc:a5a511b0cc23b264826373d3dabcef670"><td class="mdescLeft">&#160;</td><td class="mdescRight">destructs the executor <br /></td></tr>
<tr class="separator:a5a511b0cc23b264826373d3dabcef670"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81f35d5b0a20ac0646447eb80d97c0aa"><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a81f35d5b0a20ac0646447eb80d97c0aa">run</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow)</td></tr>
<tr class="memdesc:a81f35d5b0a20ac0646447eb80d97c0aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow once  <a href="#a81f35d5b0a20ac0646447eb80d97c0aa">More...</a><br /></td></tr>
<tr class="separator:a81f35d5b0a20ac0646447eb80d97c0aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a94b45b69dc247c82c2ada8c90424b172"><td class="memTemplParams" colspan="2">template&lt;typename C &gt; </td></tr>
<tr class="memitem:a94b45b69dc247c82c2ada8c90424b172"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a94b45b69dc247c82c2ada8c90424b172">run</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow, C &amp;&amp;callable)</td></tr>
<tr class="memdesc:a94b45b69dc247c82c2ada8c90424b172"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow once and invoke a callback upon completion  <a href="#a94b45b69dc247c82c2ada8c90424b172">More...</a><br /></td></tr>
<tr class="separator:a94b45b69dc247c82c2ada8c90424b172"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adca6cd0ce1bd7e6fa2ed2a55c9ae15e6"><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#adca6cd0ce1bd7e6fa2ed2a55c9ae15e6">run_n</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow, size_t N)</td></tr>
<tr class="memdesc:adca6cd0ce1bd7e6fa2ed2a55c9ae15e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow for N times  <a href="#adca6cd0ce1bd7e6fa2ed2a55c9ae15e6">More...</a><br /></td></tr>
<tr class="separator:adca6cd0ce1bd7e6fa2ed2a55c9ae15e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aff558312e64d19f98f26c91349c317da"><td class="memTemplParams" colspan="2">template&lt;typename C &gt; </td></tr>
<tr class="memitem:aff558312e64d19f98f26c91349c317da"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#aff558312e64d19f98f26c91349c317da">run_n</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow, size_t N, C &amp;&amp;callable)</td></tr>
<tr class="memdesc:aff558312e64d19f98f26c91349c317da"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow for N times and then invokes a callback  <a href="#aff558312e64d19f98f26c91349c317da">More...</a><br /></td></tr>
<tr class="separator:aff558312e64d19f98f26c91349c317da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8acf7515e8e8fdda366ace68bcd65aa6"><td class="memTemplParams" colspan="2">template&lt;typename P &gt; </td></tr>
<tr class="memitem:a8acf7515e8e8fdda366ace68bcd65aa6"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a8acf7515e8e8fdda366ace68bcd65aa6">run_until</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow, P &amp;&amp;pred)</td></tr>
<tr class="memdesc:a8acf7515e8e8fdda366ace68bcd65aa6"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow multiple times until the predicate becomes true and then invokes a callback  <a href="#a8acf7515e8e8fdda366ace68bcd65aa6">More...</a><br /></td></tr>
<tr class="separator:a8acf7515e8e8fdda366ace68bcd65aa6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85f5cd590d2dbe15d1f2f1f8d920a7e6"><td class="memTemplParams" colspan="2">template&lt;typename P , typename C &gt; </td></tr>
<tr class="memitem:a85f5cd590d2dbe15d1f2f1f8d920a7e6"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a85f5cd590d2dbe15d1f2f1f8d920a7e6">run_until</a> (<a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;taskflow, P &amp;&amp;pred, C &amp;&amp;callable)</td></tr>
<tr class="memdesc:a85f5cd590d2dbe15d1f2f1f8d920a7e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs the taskflow multiple times until the predicate becomes true and then invokes the callback  <a href="#a85f5cd590d2dbe15d1f2f1f8d920a7e6">More...</a><br /></td></tr>
<tr class="separator:a85f5cd590d2dbe15d1f2f1f8d920a7e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9aa252f70e9a40020a1e5a89d485b85"><td class="memItemLeft" align="right" valign="top"><a id="ab9aa252f70e9a40020a1e5a89d485b85"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#ab9aa252f70e9a40020a1e5a89d485b85">wait_for_all</a> ()</td></tr>
<tr class="memdesc:ab9aa252f70e9a40020a1e5a89d485b85"><td class="mdescLeft">&#160;</td><td class="mdescRight">wait for all pending graphs to complete <br /></td></tr>
<tr class="separator:ab9aa252f70e9a40020a1e5a89d485b85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79223c7f32c9d715e725b8d775de2d29"><td class="memItemLeft" align="right" valign="top"><a id="a79223c7f32c9d715e725b8d775de2d29"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a79223c7f32c9d715e725b8d775de2d29">num_workers</a> () const</td></tr>
<tr class="memdesc:a79223c7f32c9d715e725b8d775de2d29"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the number of worker threads (can be zero) <br /></td></tr>
<tr class="separator:a79223c7f32c9d715e725b8d775de2d29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d6c28ed58211e4c27a99571e5bf0b6c"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a6d6c28ed58211e4c27a99571e5bf0b6c">num_topologies</a> () const</td></tr>
<tr class="memdesc:a6d6c28ed58211e4c27a99571e5bf0b6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the number of running topologies at the time of this call  <a href="#a6d6c28ed58211e4c27a99571e5bf0b6c">More...</a><br /></td></tr>
<tr class="separator:a6d6c28ed58211e4c27a99571e5bf0b6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8acfc81ae6a64989761ce229262c9a21"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a8acfc81ae6a64989761ce229262c9a21">num_domains</a> () const</td></tr>
<tr class="memdesc:a8acfc81ae6a64989761ce229262c9a21"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the number of worker domains  <a href="#a8acfc81ae6a64989761ce229262c9a21">More...</a><br /></td></tr>
<tr class="separator:a8acfc81ae6a64989761ce229262c9a21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6487d589cb1f6b078b69fd3bb1082345"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a6487d589cb1f6b078b69fd3bb1082345">this_worker_id</a> () const</td></tr>
<tr class="memdesc:a6487d589cb1f6b078b69fd3bb1082345"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the id of the caller thread in this executor  <a href="#a6487d589cb1f6b078b69fd3bb1082345">More...</a><br /></td></tr>
<tr class="separator:a6487d589cb1f6b078b69fd3bb1082345"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e6866c8f1b6a2e932f06d0b4eb032c0"><td class="memTemplParams" colspan="2">template&lt;typename F , typename... ArgsT&gt; </td></tr>
<tr class="memitem:a1e6866c8f1b6a2e932f06d0b4eb032c0"><td class="memTemplItemLeft" align="right" valign="top">auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a1e6866c8f1b6a2e932f06d0b4eb032c0">async</a> (F &amp;&amp;f, ArgsT &amp;&amp;... args)</td></tr>
<tr class="memdesc:a1e6866c8f1b6a2e932f06d0b4eb032c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">runs a given function asynchronously  <a href="#a1e6866c8f1b6a2e932f06d0b4eb032c0">More...</a><br /></td></tr>
<tr class="separator:a1e6866c8f1b6a2e932f06d0b4eb032c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e68a0d779cfee1554c88c2596ae9000"><td class="memTemplParams" colspan="2">template&lt;typename Observer , typename... Args&gt; </td></tr>
<tr class="memitem:a3e68a0d779cfee1554c88c2596ae9000"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr</a>&lt; Observer &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a3e68a0d779cfee1554c88c2596ae9000">make_observer</a> (Args &amp;&amp;... args)</td></tr>
<tr class="memdesc:a3e68a0d779cfee1554c88c2596ae9000"><td class="mdescLeft">&#160;</td><td class="mdescRight">constructs an observer to inspect the activities of worker threads  <a href="#a3e68a0d779cfee1554c88c2596ae9000">More...</a><br /></td></tr>
<tr class="separator:a3e68a0d779cfee1554c88c2596ae9000"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31081f492c376f7b798de0e430534531"><td class="memTemplParams" colspan="2"><a id="a31081f492c376f7b798de0e430534531"></a>
template&lt;typename Observer &gt; </td></tr>
<tr class="memitem:a31081f492c376f7b798de0e430534531"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#a31081f492c376f7b798de0e430534531">remove_observer</a> (<a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr</a>&lt; Observer &gt; observer)</td></tr>
<tr class="memdesc:a31081f492c376f7b798de0e430534531"><td class="mdescLeft">&#160;</td><td class="mdescRight">removes the associated observer <br /></td></tr>
<tr class="separator:a31081f492c376f7b798de0e430534531"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab92083be20ea77b9fb3eb8ea2d26af68"><td class="memItemLeft" align="right" valign="top"><a id="ab92083be20ea77b9fb3eb8ea2d26af68"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtf_1_1Executor.html#ab92083be20ea77b9fb3eb8ea2d26af68">num_observers</a> () const</td></tr>
<tr class="memdesc:ab92083be20ea77b9fb3eb8ea2d26af68"><td class="mdescLeft">&#160;</td><td class="mdescRight">queries the number of observers <br /></td></tr>
<tr class="separator:ab92083be20ea77b9fb3eb8ea2d26af68"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a61184f9bd9c801d0a5eccecfdbddc641"><td class="memItemLeft" align="right" valign="top"><a id="a61184f9bd9c801d0a5eccecfdbddc641"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>FlowBuilder</b></td></tr>
<tr class="separator:a61184f9bd9c801d0a5eccecfdbddc641"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa48945297ede77a161defc88033ce8a6"><td class="memItemLeft" align="right" valign="top"><a id="aa48945297ede77a161defc88033ce8a6"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>Subflow</b></td></tr>
<tr class="separator:aa48945297ede77a161defc88033ce8a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9f64f729511a922781a59663ff1c6250"><td class="memItemLeft" align="right" valign="top"><a id="a9f64f729511a922781a59663ff1c6250"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>cudaFlow</b></td></tr>
<tr class="separator:a9f64f729511a922781a59663ff1c6250"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>execution interface for running a taskflow graph </p>
<p>An executor object manages a set of worker threads to run taskflow(s) using an efficient work-stealing scheduling algorithm. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a1e6866c8f1b6a2e932f06d0b4eb032c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e6866c8f1b6a2e932f06d0b4eb032c0">&#9670;&nbsp;</a></span>async()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F , typename... ArgsT&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">auto tf::Executor::async </td>
          <td>(</td>
          <td class="paramtype">F &amp;&amp;&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ArgsT &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>runs a given function asynchronously </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">F</td><td>callable type </td></tr>
    <tr><td class="paramname">ArgsT</td><td>parameter types</td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>callable object to call </td></tr>
    <tr><td class="paramname">args</td><td>parameters to pass to the callable</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> that will eventually hold the result of the function call </dd></dl>

</div>
</div>
<a id="a3e68a0d779cfee1554c88c2596ae9000"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e68a0d779cfee1554c88c2596ae9000">&#9670;&nbsp;</a></span>make_observer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Observer , typename... Args&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/memory/shared_ptr.html">std::shared_ptr</a>&lt; Observer &gt; tf::Executor::make_observer </td>
          <td>(</td>
          <td class="paramtype">Args &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>constructs an observer to inspect the activities of worker threads </p>
<p>Each executor manage a list of observers in shared ownership with callers.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Observer</td><td>observer type derived from <a class="el" href="classtf_1_1ObserverInterface.html" title="The interface class for creating an executor observer. ">tf::ObserverInterface</a> </td></tr>
    <tr><td class="paramname">ArgsT...</td><td>argument parameter pack</td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">args</td><td>arguments to forward to the constructor of the observer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a shared pointer to the created observer </dd></dl>

</div>
</div>
<a id="a8acfc81ae6a64989761ce229262c9a21"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8acfc81ae6a64989761ce229262c9a21">&#9670;&nbsp;</a></span>num_domains()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t tf::Executor::num_domains </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>queries the number of worker domains </p>
<p>Each domain manages a subset of worker threads to execute domain-specific tasks, for example, HOST tasks and CUDA tasks. </p>

</div>
</div>
<a id="a6d6c28ed58211e4c27a99571e5bf0b6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d6c28ed58211e4c27a99571e5bf0b6c">&#9670;&nbsp;</a></span>num_topologies()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t tf::Executor::num_topologies </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>queries the number of running topologies at the time of this call </p>
<p>When a taskflow is submitted to an executor, a topology is created to store runtime metadata of the running taskflow. </p>

</div>
</div>
<a id="a81f35d5b0a20ac0646447eb80d97c0aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81f35d5b0a20ac0646447eb80d97c0aa">&#9670;&nbsp;</a></span>run() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>runs the taskflow once </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="a94b45b69dc247c82c2ada8c90424b172"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a94b45b69dc247c82c2ada8c90424b172">&#9670;&nbsp;</a></span>run() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">C &amp;&amp;&#160;</td>
          <td class="paramname"><em>callable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>runs the taskflow once and invoke a callback upon completion </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> object </td></tr>
    <tr><td class="paramname">callable</td><td>a callable object to be invoked after this run</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="adca6cd0ce1bd7e6fa2ed2a55c9ae15e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adca6cd0ce1bd7e6fa2ed2a55c9ae15e6">&#9670;&nbsp;</a></span>run_n() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run_n </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>N</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>runs the taskflow for N times </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> object </td></tr>
    <tr><td class="paramname">N</td><td>number of runs</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="aff558312e64d19f98f26c91349c317da"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aff558312e64d19f98f26c91349c317da">&#9670;&nbsp;</a></span>run_n() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run_n </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>N</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">C &amp;&amp;&#160;</td>
          <td class="paramname"><em>callable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>runs the taskflow for N times and then invokes a callback </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> </td></tr>
    <tr><td class="paramname">N</td><td>number of runs </td></tr>
    <tr><td class="paramname">callable</td><td>a callable object to be invoked after this run</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="a8acf7515e8e8fdda366ace68bcd65aa6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8acf7515e8e8fdda366ace68bcd65aa6">&#9670;&nbsp;</a></span>run_until() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename P &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run_until </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">P &amp;&amp;&#160;</td>
          <td class="paramname"><em>pred</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>runs the taskflow multiple times until the predicate becomes true and then invokes a callback </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> </td></tr>
    <tr><td class="paramname">pred</td><td>a boolean predicate to return true for stop</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="a85f5cd590d2dbe15d1f2f1f8d920a7e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a85f5cd590d2dbe15d1f2f1f8d920a7e6">&#9670;&nbsp;</a></span>run_until() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename P , typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a>&lt; void &gt; tf::Executor::run_until </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtf_1_1Taskflow.html">Taskflow</a> &amp;&#160;</td>
          <td class="paramname"><em>taskflow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">P &amp;&amp;&#160;</td>
          <td class="paramname"><em>pred</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">C &amp;&amp;&#160;</td>
          <td class="paramname"><em>callable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>runs the taskflow multiple times until the predicate becomes true and then invokes the callback </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">taskflow</td><td>a <a class="el" href="classtf_1_1Taskflow.html" title="main entry to create a task dependency graph ">tf::Taskflow</a> </td></tr>
    <tr><td class="paramname">pred</td><td>a boolean predicate to return true for stop </td></tr>
    <tr><td class="paramname">callable</td><td>a callable object to be invoked after this run</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="elRef" doxygen="/Users/twhuang/PhD/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/future.html">std::future</a> to access the execution status of the taskflow </dd></dl>

</div>
</div>
<a id="a6487d589cb1f6b078b69fd3bb1082345"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6487d589cb1f6b078b69fd3bb1082345">&#9670;&nbsp;</a></span>this_worker_id()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int tf::Executor::this_worker_id </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>queries the id of the caller thread in this executor </p>
<p>Each worker has an unique id from 0 to N-1 exclusive to the associated executor. If the caller thread does not belong to the executor, -1 is returned. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="executor_8hpp_source.html">executor.hpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>tf</b></li><li class="navelem"><a class="el" href="classtf_1_1Executor.html">Executor</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
